#pragma once
#include "IRenderableComponent.h"

namespace ZeEngine
{
    class SDLTexture;
	class ResourceManager;

    class SpriteComponent : public IRenderableComponent
    {
		friend class SDLRenderable;

    public:
        SpriteComponent(SDLTexture* pTexture);
        SpriteComponent(SDLTexture* pTexture, const SDL_Rect& rect);
		SpriteComponent(ResourceManager& resourceManager, const std::string& textureName, const std::string& textureGroup);
		SpriteComponent(ResourceManager& resourceManager, const std::string& textureName, const std::string& textureGroup, const SDL_Rect& rect);

        ~SpriteComponent();

        const SDL_Rect&        GetTextureRect()     const;

    private:

        SDLTexture*      m_pTexture;

        mutable SDL_Rect m_textureRect;
        mutable bool     m_initialized;

	private:

        virtual void Render(SDL_Renderer& renderer, const Vector2D<float> position, const f32 rotation, f32 interpolation) override;
		SDLTexture* GetTexture() const override { return m_pTexture; }

#define ICOMPONENT_I
#include ICOMPONENT_H
    };
}

